// 加载层
var loadindex = layer.load(1,{
    shade:[1,"#000"]
})
var pageSize = 8
$.get('./list.php',res=>{
    // 加载好数据
    var {meta:{status,msg},data} = res;
    if(status === 1){
        new Page('fenye',{
            pageData:{
                total:data.length,
                pageSize
            },
            show:function(currentPage){
                var arr = data.slice((currentPage-1)*pageSize,currentPage*pageSize)
                var str = '';
                
                for(var i=0;i<arr.length;i++){
                    str += `
                        <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12" style="background-color: #fff;margin:10px;width:250px;">
                            <div class="thumbnail">
                                <img src="${arr[i].imgpath.split('==========')[0]}" alt="...">
                                <div class="caption">
                                    <h3>${arr[i].name}</h3>
                                    <p class="introduce">${arr[i].introduce}</p>
                                    <p><a href="shoujifangdajing.html?id=${arr[i].id}" class="btn btn-primary" role="button"margin-bottom:10px;>点击购买</a> </p>
                                </div>
                            </div>
                        </div>
                    `
                }
                $('.goods .row').html(str)
            }
        })
    }
    layer.close(loadindex)
},'json')